<script setup>
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
import { getUserInfo } from '@api/user'
const router = useRouter()
const state = reactive({
  userName: '',
  passWord: ''
})
const login = async () => {
  await getUserInfo()
  window.localStorage.setItem('token', 'haha')
  router.push('/main')
}
</script>
<template>
  <div class="space-y-[20px] p-[20px]">
    <el-input v-model="state.userName" placeholder="用户名" />
    <el-input v-model="state.passWord" placeholder="密码" />
    <el-button
      class="w-[100%]"
      :disabled="!state.userName || !state.passWord"
      type="primary"
      @click="login"
      >登录</el-button
    >
  </div>
</template>
